package com.leonard.event.listener;

import com.leonard.event.entity.UserBean;
import com.leonard.event.event.UserRegisterEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;

/**
 * @description:原始方式实现用户注册监听
 * @author: qizheng.sun
 * @createDate: 2020/9/29
 * @version: 1.0
 */
@Component
public class RegisterListener implements ApplicationListener<UserRegisterEvent> {
    @Override
    public void onApplicationEvent(UserRegisterEvent userRegisterEvent) {
        //获取注册用户对象
        UserBean user = userRegisterEvent.getUser();

        //../省略逻辑

        //输出注册用户信息
        System.out.println("原始方式注册信息，用户名："+user.getName()+"，密码："+user.getPassword());
    }
}
